home *** CD-ROM | disk | FTP | other *** search
/ The Fatted Calf / The Fatted Calf.iso / Applications / GraphicViewers / pCD / Source / hpcdtoppm.0.4 / Adding_code next >
Text File  |  1993-03-23  |  2KB  |  60 lines

  1. Several people were changing the output image format
  2. of the decoder or asked for a different output format.
  3.  
  4. pbmplus enables the transformation to every image
  5. format, but sometimes it is better to have the
  6. format "inside". Therefore v0.4 is able to keep several
  7. format 'drivers'. 
  8.  
  9.  
  10. To add a new output format:
  11.  
  12. - Append a new tag to the enum type OUTFOR in hpcdtoppm.h
  13.  
  14. - change O_DEFAULT to this tag in config.h if you want to
  15.   have this format as the default format.
  16.  
  17. - Insert a new 'if(...{...}' contruct to the procedure
  18.   parseargs in main.c after the comment "Output options".
  19.  
  20. - Insert description text to error.c and hpcdtoppm.man.
  21.  
  22. - If your format needs only grayscale data, append your
  23.   tag to the line "monochrome=(outfor==O_PGM)|| ..."
  24.   in the main procedure in main.c .
  25.  
  26. - Insert your tag into the switch-statement in the
  27.   procedure colconvert in color.c. If you need a
  28.   8-bit-grayscale or 24-bit-rgb model, you just
  29.   have to insert a "case O_YourTag :" . Otherwise
  30.   you have to write your own colorconversion.
  31.  
  32. - Insert your tag into the switch-statement in the
  33.   procedure colconvert in output.c. If you have
  34.   a three-plane-image you can use the do_3plane
  35.   procedure with a pointer to your format writing
  36.   procedure as the first argument, if you have one 
  37.   image plane, use the do_1plane. Otherwise write 
  38.   a similar do_nplane  procedure.
  39.  
  40. - Write a procedure, which produces your format. You
  41.   should use the same parameter scheme as the included
  42.   procedures (read ppm.c). 
  43.  
  44.   This means:
  45.   -image width and height.
  46.   
  47.   - for each image plane the triple:
  48.     - a pointer to the upper left position
  49.     - a relative row step    ( in bytes )
  50.     - a relative column step ( in bytes )
  51.     
  52.  
  53.  
  54.  
  55. Hadmut
  56.  
  57.  
  58.  
  59.  
  60.